<script setup lang="ts">
import { ref } from 'vue'

const props = defineProps(['videoInfo'])
const v = ref(props.videoInfo)
</script>

<template>
  <router-link target="_blank" :to="`/play/${v.vod_id}`">
    <div class="showItem">
      <div class="showItem-img">
        <el-image class="showItem-img-elImage" :src="v.vod_pic" fit="cover"> </el-image>
        <div class="showItem-tag">
          <div style="background: rgb(255, 221, 154); color: rgb(78, 45, 3)" v-if="parseFloat(v.vod_douban_score) > 7">豆瓣高分</div>
          <div style="background: rgb(255, 91, 36); color: #fff" v-else-if="parseInt(v.vod_year) < 2015">高清经典</div>
          <div style="background: rgb(3, 200, 212); color: #fff" v-else-if="Math.abs(new Date().getTime() / 1000 - parseInt(v.vod_time_add)) < 604800">首播</div>
          <div style="background: rgb(255, 0, 140); color: #fff" v-else-if="Math.abs(new Date().getTime() / 1000 - parseInt(v.vod_time_add)) < 2592000">近期热播</div>
        </div>
      </div>
      <div class="showItem-infoBox">
        <p class="showItem-infoBox-title">{{ v.vod_name.trim() }}</p>
        <div class="showItem-infoBox-content" alt="v.vod_blurb.trim()">{{ v.vod_blurb.trim() || '该片暂无介绍' }}</div>
      </div>
    </div>
  </router-link>
</template>

<style scoped lang="less">
.router-link-active {
  text-decoration: none;
}
a {
  text-decoration: none;
}
.showItem {
  height: 100%;
  color: #fff;
  margin-bottom: 20px;
  // padding-bottom: 30px;
  &-img {
    position: relative;
    width: 100%;
    padding-top: 140%;
    border-radius: 15px;
    overflow: hidden;
    background: #222;

    &-elImage {
      position: absolute;
      left: 0;
      top: 0;
      width: 100%;
      height: 100%;
      transition: 0.3s;
      cursor: pointer;

      &:hover {
        width: 106%;
        height: 106%;
        top: -3%;
        left: -3%;
        transition: 0.3s;
      }
    }

    .showItem-tag {
      position: absolute;
      top: 0;
      right: 0;
      font-size: 7px;
      border-radius: 0 0 0 15px;
      overflow: hidden;

      > div {
        padding: 5px 10px 5px;
        background: #f00;
      }
    }
  }

  &-infoBox {
    &-title {
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      font-size: 16px;
      margin: 10px 0 3px;
      color: #eee;
    }
    &-content {
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      font-size: 13px;
      color: #999;
    }
  }
}
</style>
